// Person.h
#include <iostream>
#include <string>
using namespace std;

class Person
{
public:
    Person() : name("lc") {}
    ~Person() {}
    void setName(const string &name) { cout << "Person::setName()" << endl; }
    string getName() const { return name; }
    void setAge(int age) {}
    int getAge() const {}
    
protected:
    string name;
private:
    int age;
};

class Student : public Person
{
public:
    Student() : id(1001) { name = "zjm"; }
    ~Student() {}
    void setId(int id) {}
    int getId() const { return id; }

private:
    int id;
};

int main()
{
    Person per;
    Student stu;
    cout << "name: " << per.getName() << endl;
    per = stu;
    cout << "name: " << per.getName() << endl;
    // 实际上只是将派生类中基类部分赋值
    // cout << "name: " << per.getId() << endl;

    // 基类不能给派生类赋值
    // stu = per;
    return 0;
}